@echo off

if "%1" == "" goto syntax_error
if "%2" == "" goto syntax_error
if "%3" == "" goto syntax_error
if "%4" == "" goto syntax_error

set TOOL_DBSERVER=%1
set TOOL_DBNAME=%2
set TOOL_DBACCOUNT=%3
set TOOL_DBPASSWORD=%4
set TOOL_DBSPDIR=StoredProcedures

@echo Create Stored procedures....


@echo CreatePassword
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.CreatePassword.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo DepersonateCouple
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.DepersonateCouple.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo CheckAndPerformDepersonation
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.CheckAndPerformDepersonation.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo FindCeremoniesForMinister
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.FindCeremoniesForMinister.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo FindMinisters
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.FindMinisters.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetAvailableLanguagesForReportDefinition
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetAvailableLanguagesForReportDefinition.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetBookedTimeBlocks
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetBookedTimeBlocks.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetCeremonies
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetCeremonies.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetCeremonyLanguage
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetCeremonyLanguage.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetCertificateLanguage
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetCertificateLanguage.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetFreeTimeBlocks
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetFreeTimeBlocks.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetFreeTimeBlocksForDay
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetFreeTimeBlocksForDay.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetIndividualCeremonyBookingDetails
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetIndividualCeremonyBookingDetails.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetIndividualCeremonyBookingForDate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetIndividualCeremonyBookingForDate.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetMinisterByTicket
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetMinisterByTicket.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetMinisterTimeBlocks
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetMinisterTimeBlocks.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetNextCeremonyDateForIndividualService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetNextCeremonyDateForIndividualService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetNextCeremonyDateForOrdinaryService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetNextCeremonyDateForOrdinaryService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetNonAvailableDates
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetNonAvailableDates.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetNonFullyBookedDates
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetNonFullyBookedDates.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetOrdinaryCeremonyBookingDetails
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetOrdinaryCeremonyBookingDetails.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetOrdinaryCeremonyBookingForDate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetOrdinaryCeremonyBookingForDate.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetParvisUsers
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetParvisUsers.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetPreviousCeremonyDateForIndividualService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetPreviousCeremonyDateForIndividualService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetPreviousCeremonyDateForOrdinaryService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetPreviousCeremonyDateForOrdinaryService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportAbsentCouplesStats
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportAbsentCouplesStats.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportCancelledBookingsStats
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportCancelledBookingsStats.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportCouplesPerPeriodStats
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportCouplesPerPeriodStats.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportDefinitionLanguages
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportDefinitionLanguages.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportMarriageCertificate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportMarriageCertificate.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportMarriageMinutes
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportMarriageMinutes.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportMarriageRegister
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportMarriageRegister.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportMinisterService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportMinisterService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportReimbursment
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportReimbursment.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo GetReportTicketsForMinisterStats
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.GetReportTicketsForMinisterStats.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo InsertHistory
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.InsertHistory.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo NotifyAdministratorOfIndividualServices
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.NotifyAdministratorOfIndividualServices.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo FindTickets
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.FindTickets.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendForgottenPasswordMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendForgottenPasswordMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendIndividualBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendIndividualBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendIndividualBookingToMinisterMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendIndividualBookingToMinisterMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendMinisterServiceReminderMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendMinisterServiceReminderMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendOrdinaryBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendOrdinaryBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendPreferredOrdinaryBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendPreferredOrdinaryBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendOnePreferredOrdinaryBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendOnePreferredOrdinaryBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendOrdinaryBookingWithoutPreferredDateMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendOrdinaryBookingWithoutPreferredDateMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendPreferredDateNotificationMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendPreferredDateNotificationMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRegistrationInParvisMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRegistrationInParvisMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRegistrationMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRegistrationMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRemindCoupleOfImpedimentDocMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRemindCoupleOfImpedimentDocMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRemoveBookingImpedimentDocMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRemoveBookingImpedimentDocMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRemoveBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRemoveBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendRemoveIndividualBookingToMinisterMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendRemoveIndividualBookingToMinisterMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo NotifyCouplesWithPreferredDate
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.NotifyCouplesWithPreferredDate.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemoveBooking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemoveBooking.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo NotifyMinisterServiceAboutRemindMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.NotifyMinisterServiceAboutRemindMail.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemindCoupleOfImpedimentDocForIndividualBooking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemindCoupleOfImpedimentDocForIndividualBooking.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemindCoupleOfImpedimentDocForOrdinaryBooking
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemindCoupleOfImpedimentDocForOrdinaryBooking.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemindMinisterOfOrdinaryService
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemindMinisterOfOrdinaryService.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemoveIndividualBookingForCoupleWithMissingImpedimentDoc
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemoveIndividualBookingForCoupleWithMissingImpedimentDoc.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo RemoveOrdinaryBookingForCoupleWithMissingImpedimentDoc
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.RemoveOrdinaryBookingForCoupleWithMissingImpedimentDoc.StoredProcedure.sql
if errorlevel 1 goto sql_error

@echo SendConfirmedBookingMail
call SqlCommand %TOOL_DBSERVER% %TOOL_DBNAME% %TOOL_DBACCOUNT% %TOOL_DBPASSWORD% %TOOL_DBSPDIR%\dbo.SendConfirmedBookingMail.StoredProcedure.sql
if errorlevel 1 goto sql_error


@echo *************************************************************
@echo *
@echo * All stored procedures created successfully.
@echo *
@echo *************************************************************
goto end


:syntax_error
@echo *************************************************************
@echo *
@echo * Syntax error!
@echo * Required parameter is missing.
@echo *
@echo * Usage: CreateStoredProcedures 'DatabaseServerName' DatabaseName' 'Account' 'Password'
@echo *
@echo *************************************************************
goto end


:sql_error
:end
